package com.cc.controller;

import com.cc.entity.User;
import com.cc.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 铁憨憨
 * @date 2021/2/5 22:03
 */
@RestController
public class TeacherController {
    @Autowired
    private TeacherService teacherService;
    @Value("${server.port}")
    private String port;

    @GetMapping("getUserList")
    public List<User> getUserList(){
        return teacherService.getUserList();
    }
    @GetMapping("getUserById/{id}")
    public String getUserById(@PathVariable("id")Integer id){
        String userById = teacherService.getUserById(id);
        return userById+"----->"+port;
    }
}
